package org.jtb.mensawotd;

import android.app.Application;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.Log;

public class MensaWotdApplication extends Application {

	@Override
	public void onCreate() {
		super.onCreate();
		
		try {
			int thisVersion = getPackageManager().getPackageInfo(getPackageName(), 0 ).versionCode;
			Prefs prefs = new Prefs(this);
			int lastVersion = prefs.getVersion();
			
			if (lastVersion <= 11) {
				new Prefs(this).clearHistory();
			}
			prefs.setVersion(thisVersion);
		} catch (NameNotFoundException e) {
			Log.e("mensawotd", "could not get version code", e);
		}

	}
}
